import { DataBlocker, DataProxy } from "../../frame/A-LIB/lib.b.data";

class User {
	/** 用户当前的关卡自然数，从1开始 */
	round: number;

	remove_count: number;

	/** 是否开启背景音乐 */
	bgm: boolean;

	task_round: string;
	task_remove: string;
	guide_record: string;
}

const blocker: DataBlocker<User> = {
	get: {
		round(proxy, value) {
			return value ?? 1;
		},
		bgm(proxy, value) {
			return value ?? true;
		},
		task_remove(proxy, value) {
			return value ?? '';
		},
		task_round(proxy, value) {
			return value ?? '';
		},
		remove_count(proxy, value) {
			return value ?? 0;
		},
		guide_record(proxy, value) {
			return value ?? '';
		},
	}
}

export default function get_proxy_user(name?: string, prefix?: string){
	return DataProxy.initProxy(name??'user', new User(), true, blocker, prefix??'');
}